package KitDates;

use Date::Pcalc qw(:all);
use Class::Date qw(date);

sub new 
{
    my $class   = shift;
    my $self 	= {};
    bless $self, 'KitDates';
    return $self;
}

=pod
	Return date-time in format yyyy-mm-dd hh:MM:ss, given delta_hr.
=cut
sub getDateTime
{
	my ($self, $delta_hr)	= @_;

	my ($y, $m, $d) 	= Today();
	my ($hr, $min, $sec)	= Now();

	($y, $m, $d, $hr, $min, $sec) = Add_Delta_DHMS($y, $m, $d, $hr, $min, $sec, 0, $delta_hr, 0, 0);

	return "$y-$m-$d $hr:$min:$sec";
}

=pod
	Returns a date that is offset by $delta.
	Returns current date if $delta is not passed
=cut
sub getDate
{
	my ($self, $delta)	= @_;

	$delta	= 0 if (!$delta);

	my ($y, $m, $d) = Today();

	my ($delta_y, $delta_m, $delta_d) = Add_Delta_Days(Today(), $delta);
	return "$delta_y-$delta_m-$delta_d";
}

1;